package cn.shop.transcation.withdraw.entity;

import cn.shop.base.BaseEntity;
import cn.shop.utils.enums.ProcessState;
import cn.shop.utils.enums.WithdrawAccountType;
import cn.shop.utils.enums.WithdrawChannel;
import cn.shop.utils.enums.WithdrawSolution;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 提现(Withdraw)表实体类
 *
 * @author jzw
 * @since 2021-11-10 10:06:01
 */
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class Withdraw extends BaseEntity {


	private static final long serialVersionUID = -2359127822346722783L;

	/**
	 * 商户/玩家 id
	 */
	private Long userId;

	/**
	 * 提现金额
	 */
	private BigDecimal amount;

	/**
	 * 实际到账金额
	 */
	private BigDecimal actualAmount;

	/**
	 * 总手续费
	 */
	private BigDecimal charges;

	/**
	 * 单笔手续费
	 */
	private BigDecimal chargeSingle;

	/**
	 * 金额费率手续费
	 */
	private BigDecimal chargeRate;

	/**
	 * 当前余额
	 */
	private BigDecimal balance;

	/**
	 * 状态 1 未处理 2 处理中 3 已完成 4 异常
	 */
	private ProcessState state;

	/**
	 * 解决方案: 1 代付结算 2 支付宝结算 3 三方代付结算
	 */
	private WithdrawSolution solution;

	/**
	 * 用户类型 1 商户 2 玩家
	 */
	@JsonProperty(access = Access.READ_ONLY)
	private Integer type;

	/**
	 * 提现账户/银行卡号
	 */
	@TableField(condition = SqlCondition.LIKE)
	private String account;

	/**
	 * 银行名称
	 */
	private String bankName;

	/**
	 * 提现账户
	 */
	private WithdrawAccountType accountType;


	/**
	 * 开户名
	 */
	@TableField(condition = SqlCondition.LIKE)
	private String bankAccountName;

	/**
	 * 身份证号
	 */
	private String idCard;

	/**
	 * 银行预留电话
	 */
	private String phone;

	/**
	 * 异常信息
	 */
	private String exceptionInfo;

	/**
	 * 结算成功时间
	 */
	private LocalDateTime paymentTime;

	@TableField(exist = false)
	private Boolean warn;

	/**
	 * 提现渠道
	 */
	private WithdrawChannel channel;

	/**
	 * 代付渠道代码
	 */
	private Long paymentChannelId;

	/**
	 * 玩家账号
	 */
	@TableField(exist = false)
	private String playerAccount;
}

